
//function
let func = function(message) {
    console.log(message);
}

let func2 = (message: string) => {
    console.log(message);
}
//像func2函数，函数体只有一个语句，可以简写成log3的形式
let func3 = (message: string) => console.log(message);
func3("hello");
//func3(2); //不是string类型就报错
//func3(true); //不是string类型就报错

//必选参数不能出现在可选参数之后
// let func4 = (message?: string, code: number) => { //报错
//     console.log(message, code);
// }

let func4 = (message: string, code: number = 0, remark?: string) => { //设置code默认值，remark为可选参数
    console.log(message, code, remark);
}

func4("simon", 100, "hello");